﻿using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Linq;
using System.Text;

namespace Cloak.Mvp
{
	/// <summary>
	/// Describes a presenter which can be bound to a view
	/// </summary>
	[ContractClass(typeof(IPresenterReferenceContract))]
	public interface IPresenterReference
	{
		/// <summary>
		/// Creates a presenter in the specified context
		/// </summary>
		/// <param name="context">The context in which the presenter is created</param>
		/// <param name="view">The view bound to the presenter</param>
		/// <returns>The presenter instance</returns>
		object CreateIn(IPresenterContext context, object view);
	}

	[ContractClassFor(typeof(IPresenterReference))]
	internal abstract class IPresenterReferenceContract : IPresenterReference
	{
		object IPresenterReference.CreateIn(IPresenterContext context, object view)
		{
			Contract.Requires(context != null);
			Contract.Requires(view != null);

			return null;
		}
	}
}